/*
 * @Author: huaze.fan@huifu.com fanhuaze_1114@126.com
 * @Date: 2023-04-16 00:07:25
 * @LastEditors: huaze.fan@huifu.com fanhuaze_1114@126.com
 * @LastEditTime: 2024-04-06 15:49:37
 * @FilePath: /quality_center_app/lib/core/utils/Util.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:quality_center_app/core/utils/Util.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:intl/intl.dart';
import 'package:quality_center_app/widget/ts_loading.dart';

class FormualUtil {
  // 粉煤灰-烧失量试验结果计算公式
  // （试样质量 val1 - 灼烧后质量 val2 ）/ 试样质量 val1 * 100%
  static String getSaoshiliangResult(val1, val2) {
    String re = "";
    print('粉煤灰-烧失量试验结果计算公式:${val1}-----${val2}');
    if (!Util.isEmptyString(val1) && !Util.isEmptyString(val2)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      if (value2 > value1) {
        re = '0.00';
      } else {
        re = ((value1 - value2) * 100 / value1).toStringAsFixed(2);
      }
    }
    return re;
  }

  // 获取平均值
  static String getPingJunZhi(val1, val2) {
    String re = "";
    print('需要计算平均值的两个数字：${val1}---${val2}');
    if (!Util.isEmptyString(val1) || !Util.isEmptyString(val2)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      re = ((value1 + value2) / 2.0).toStringAsFixed(2);
    }
    print('获取到的平均值：${re}');
    return re;
  }



  // 获取抗折强度
  // 参数依次 荷载  距离  宽度
  static String getKangZheStrong(val1, val2, val3) {
    String re = "0.00";
    if (!Util.isEmptyString(val1) && !Util.isEmptyString(val2) && !Util.isEmptyString(val3)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      var value3 = Util.getSafeDouble(val3);
      re = ((1.5 * value1 * value2) / value3).toStringAsFixed(2);
    }
    print('获取到的抗折强度：${re}');
    return re;
  }

  // 将时间 HH:MM 装换成分钟
  static getMinutesinteger(timeString){
    // 分离小时和分钟
    int hours = int.parse(timeString.split(':').first); // 获取小时
    int minutes = int.parse(timeString.split(':').last); // 获取分钟
    // 将小时转换为分钟并加上剩余的分钟数
    int totalMinutes = hours * 60 + minutes;
    return totalMinutes;
  }

  // time1 是否 大于 time2
  static isBeforeTime(time1, time2){
    bool before = false;
    var formatter = DateFormat('MM-dd HH:mm');
    DateTime dateTime1 = formatter.parse(time1);
    DateTime dateTime2 = formatter.parse(time2);
    if (dateTime1.isBefore(dateTime2)) {
      before = true;
    }
    return before;
  }

  // 时间差  time2-time1
  static getDifficentTime(time1, time2, title) {
    // 假设 time1 和 time2 格式为 "mm-dd hh:mm"
    // 使用DateFormatter解析时间字符串
    var formatter = DateFormat('MM-dd HH:mm');
    try {
      DateTime dateTime1 = formatter.parse(time1);
      DateTime dateTime2 = formatter.parse(time2);
      if (dateTime1.isBefore(dateTime2)) {
        TSLoading.showToast(title);
        return '00:00';
      }
      // 计算时间差
      Duration difference = dateTime1.difference(dateTime2);
      // 将时间差转换为小时和分钟
      String twoDigit(int n) => n.toString().padLeft(2, '0');
      String hours = twoDigit(difference.inHours); // 获取小时数，确保不超过24小时
      String minutes = twoDigit(difference.inMinutes.remainder(60) % 60); // 获取分钟数
      return '$hours:$minutes';
    } catch (e, r) {
      return '00:00';
    }
  }

  // 获取抗压强度平均值
  static String getKangYaPingJunZhi(val1, val2, val3, val4, val5, val6) {
    String re = "";
    print('需要计算平均值的两个数字：${val1}---${val2}');
    if (!Util.isEmptyString(val1) ||
        !Util.isEmptyString(val2) ||
        !Util.isEmptyString(val3) ||
        !Util.isEmptyString(val4) ||
        !Util.isEmptyString(val5) ||
        !Util.isEmptyString(val6)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      var value3 = Util.getSafeDouble(val3);
      var value4 = Util.getSafeDouble(val4);
      var value5 = Util.getSafeDouble(val5);
      var value6 = Util.getSafeDouble(val6);
      re = ((value1 + value2 + value3 + value4 + value5 + value6) / 6.0)
          .toStringAsFixed(2);
    }
    print('获取到的平均值----：${re}');
    return re;
  }

  // 粉煤灰-烧失量单项结论
  static String getSaoshiliangDXJL(val1, level) {
    var re = '';
    var pingjun = Util.getSafeDouble(val1);
    // 三级
    if (level.indexOf('III') != -1) {
      if (pingjun <= 15) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 二级
    } else if (level.indexOf('II') != -1) {
      if (pingjun <= 8) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 一级
    } else if (level.indexOf('I') != -1) {
      if (pingjun <= 5) {
        re = '合格';
      } else {
        re = '不合格';
      }
    }
    return re;
  }

  // 矿渣粉-样品密度加测结果
  // 质量，第一次读数，第二次读数
  static String getYangPingMiduJianCeJieGuo(val1, val2, val3) {
    var re = '';
    if (!Util.isEmptyString(val1) &&
        !Util.isEmptyString(val2) &&
        !Util.isEmptyString(val3)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      var value3 = Util.getSafeDouble(val3);
      if (value2 == value3) {
        re = '0.00';
      } else {
        re = ((value1 / (value3 - value2))).toStringAsFixed(2);
      }
      print('矿渣粉-样品密度加测结果:${re}---${value1}----${value2}====${value3}');
    }
    return re;
  }

  // 粉煤灰-计算细度
  // val1 筛余物量   val2 试样质量
  static String getXiDu(val1, val2) {
    var re = '';
    if (!Util.isEmptyString(val1) && !Util.isEmptyString(val2)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      re = ((value1 / value2) * 100).toStringAsFixed(1);
      print('粉煤灰-计算细度:${re}---${value1}----${value2}');
    }
    return re;
  }

  // 矿渣粉计算结果
  // val1 筛余物量  / val2 试样质量
  static String getKuangResult(val1, val2) {
    var re = '';
    if (!Util.isEmptyString(val1) && !Util.isEmptyString(val2)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      re = ((value1 / value2) * 100).toStringAsFixed(2);
      print('矿渣粉计算结果:${re}---${value1}----${value2}');
    }
    return re;
  }

  // 矿渣粉活性单项结论
  // val1 活性指数  level 试样等级  S105   S95   S75  类型 type 7d   28d
  static String getKuangHuoXingSLJL(val1, level, type) {
    var re = '';
    var checkvalue1 = 95;
    var checkvalue2 = 70;
    var checkvalue3 = 55;
    if (type == '28d') {
      checkvalue1 = 105;
      checkvalue2 = 95;
      checkvalue3 = 75;
    }
    // 三级
    if (level.indexOf('105') != -1) {
      if (Util.getSafeDouble(val1) > checkvalue1) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 二级
    } else if (level.indexOf('95') != -1) {
      if (Util.getSafeDouble(val1) > checkvalue2) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 一级
    } else if (level.indexOf('I') != -1) {
      if (Util.getSafeDouble(val1) > checkvalue3) {
        re = '合格';
      } else {
        re = '不合格';
      }
    }
    return re;
  }

  // 抗压强度
  // val1 筛余物量   val2 试样质量
  static String getKangYaQiangDu(val1, val2) {
    var re = '';
    if (!Util.isEmptyString(val1) && !Util.isEmptyString(val2)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      re = (value1 / value2).toStringAsFixed(2);
      print('粉煤灰-计算细度:${re}---${value1}----${value2}');
    }
    return re;
  }

  // 粉煤灰-计算细度
  // val1 筛余物量   val2 试样质量
  static String getXuShuiLiang(val1, val2) {
    var re = '';
    if (!Util.isEmptyString(val1) && !Util.isEmptyString(val2)) {
      var value1 = Util.getSafeDouble(val1);
      var value2 = Util.getSafeDouble(val2);
      re = ((value1 / value2) * 100).toStringAsFixed(2);
      print('粉煤灰-计算细度:${re}---${value1}----${value2}');
    }
    return re;
  }

  // 粉煤灰-需水量单项结论
  // val1 筛余物量   val2 试样质量, level 试样等级  I级   II级   III级
  static String getFenMeiHuiXSLJL(val1, level) {
    var re = '';
    // 三级
    if (level.indexOf('III') != -1) {
      if (Util.getSafeDouble(val1) <= 115) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 二级
    } else if (level.indexOf('II') != -1) {
      if (Util.getSafeDouble(val1) <= 105) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 一级
    } else if (level.indexOf('I') != -1) {
      if (Util.getSafeDouble(val1) <= 95) {
        re = '合格';
      } else {
        re = '不合格';
      }
    }
    return re;
  }

  // 粉煤灰-细度单项结论
  // val1 筛余物量   val2 试样质量, level 试样等级  I级   II级   III级
  static String getFenMeiHuiXDDXJL(val1, val2, level) {
    var re = '';
    var pingjun = getPingJunZhi(val1, val2);
    // 三级
    if (level.indexOf('III') != -1) {
      if (Util.getSafeDouble(pingjun) <= 45) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 二级
    } else if (level.indexOf('II') != -1) {
      if (Util.getSafeDouble(pingjun) <= 20) {
        re = '合格';
      } else {
        re = '不合格';
      }
      // 一级
    } else if (level.indexOf('I') != -1) {
      if (Util.getSafeDouble(pingjun) <= 12) {
        re = '合格';
      } else {
        re = '不合格';
      }
    }
    return re;
  }

  // 抗压单项结论
  // val1 活性指数  level 试样等级  S105   S95   S75  类型 type 7d   28d
  static String getKuangYaStrongDXJL(val1, level, type) {
    var re = '';
    switch (level) {
      case 'PO42.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 42.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 17.0) ? '合格' : '不合格';
        }
        break;
      case 'PO42.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 42.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 22.0) ? '合格' : '不合格';
        }
        break;
      case 'PO52.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 23.0) ? '合格' : '不合格';
        }
        break;
      case 'PO52.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 27.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA42.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 42.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 15.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA42.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 42.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 19.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA52.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 21.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA52.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 23.0) ? '合格' : '不合格';
        }
        break;
      case 'PSB42.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 15.0) ? '合格' : '不合格';
        }
        break;
      case 'PSB42.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 19.0) ? '合格' : '不合格';
        }
        break;
      case 'PSB52.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 21.0) ? '合格' : '不合格';
        }
        break;
      case 'PSB52.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 52.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 23.0) ? '合格' : '不合格';
        }
        break;
      // 可以有多个case
      default:
        // 如果以上case都不匹配，执行这里的代码
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 42.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 17.0) ? '合格' : '不合格';
        }
        break;
    }
    print('是否合格${re}----${type} ----${level}-----${val1}');
    return re;
  }

  // 抗折单项结论
  // val1 活性指数  level 试样等级  S105   S95   S75  类型 type 7d   28d
  static String getKuangZheStrongDXJL(val1, level, type) {
    var re = '';
    switch (level) {
      case 'PO42.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 3.0) ? '合格' : '不合格';
        }
        break;
      case 'PO42.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
        }
        break;
      case 'PO52.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
        }
        break;
      case 'PO52.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 5.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA42.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 3.5) ? '合格' : '不合格';
        }
        break;
      case 'PSA42.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 14.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA52.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
        }
        break;
      case 'PSA52.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.5) ? '合格' : '不合格';
        }
        break;
      case 'PSB42.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 3.5) ? '合格' : '不合格';
        }
        break;
      case 'PSB42.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
        }
        break;
      case 'PSB52.5':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
        }
        break;
      case 'PSB52.5R':
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 4.5) ? '合格' : '不合格';
        }
        break;
    // 可以有多个case
      default:
      // 如果以上case都不匹配，执行这里的代码
        if (type == '28d') {
          re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
        } else {
          re = (Util.getSafeDouble(val1) >= 3.0) ? '合格' : '不合格';
        }
        break;
    }
    print('是否合格${re}----${type} ----${level}-----${val1}');
    return re;
  }

  // 三氧化硫单项结论
  static String getSanYangHuaLiuDXJL({kbzl:'', lzh:'', slzl:''}){
    var re = 0.0;
    if (Util.getSafeDouble(slzl) != 0){
      re = ((Util.getSafeDouble(lzh) - Util.getSafeDouble(kbzl)) * 2.5 * 100 / (1000 * Util.getSafeDouble(slzl)));
    }
    return re <= 3.0 ? '合格' : '不合格';

  }

  // 游离氧化钙结果
  static String getYouLiYangHuaGaiResult({bjsddd:'', bzddrj:'', slzl:''}){
    var re = '';
    if (Util.getSafeDouble(slzl) != 0){
      re = ((Util.getSafeDouble(bjsddd) * Util.getSafeDouble(bzddrj)) * 100 / (1000 * Util.getSafeDouble(slzl))).toStringAsFixed(2);
    }
    return re;
  }

  // 计算水泥比表面积
  // kxl 空隙率  md 密度  bzypbbmj 标准比表面积 bzsj 标准时间  bzwd 标准温度  bznd 标准黏度  bcsj 被测时间 bcwd 被测温度 bcnd 被测黏度
  static String getShuiNiBBMJ({kxl:'', md:'', bzypbbmj:'', bzsj:'', bzwd:'', bznd:'', bcsj:'', bcwd:'', bcnd:''}) {
    var re = '';

    // 温度差
    double wdc = (Util.getSafeDouble(bzwd) - Util.getSafeDouble(bcwd)).abs();
    // 空隙率和密度相同
    bool isSame = Util.getSafeDouble(kxl) == Util.getSafeDouble(md);
    if(wdc <= 3.0 && isSame) {
      return (Util.getSafeDouble(bzypbbmj) * sqrt(Util.getSafeDouble(bcsj)) / sqrt(Util.getSafeDouble(bzsj))).toStringAsFixed(2);
    }
    if(wdc > 3.0 && isSame) {
      return ((Util.getSafeDouble(bzypbbmj) * sqrt(Util.getSafeDouble(bznd)) * sqrt(Util.getSafeDouble(bzsj)))  / (sqrt(Util.getSafeDouble(bzsj)) * sqrt(Util.getSafeDouble(bcnd)))).toStringAsFixed(2);
    }
    // switch (level) {
    //   case 'PO42.5':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 3.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PO42.5R':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PO52.5':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PO52.5R':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 5.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSA42.5':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 3.5) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSA42.5R':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 14.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSA52.5':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSA52.5R':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.5) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSB42.5':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 3.5) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSB42.5R':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSB52.5':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.0) ? '合格' : '不合格';
    //     }
    //     break;
    //   case 'PSB52.5R':
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 7.0) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 4.5) ? '合格' : '不合格';
    //     }
    //     break;
    // // 可以有多个case
    //   default:
    //   // 如果以上case都不匹配，执行这里的代码
    //     if (type == '28d') {
    //       re = (Util.getSafeDouble(val1) >= 6.5) ? '合格' : '不合格';
    //     } else {
    //       re = (Util.getSafeDouble(val1) >= 3.0) ? '合格' : '不合格';
    //     }
    //     break;
    // }
    // print('是否合格${re}----${type} ----${level}-----${val1}');
    return re;
  }
}
